package main

import (
	"github.com/gin-gonic/gin"
	"github.com/itstonight/ziyue/config"
	"github.com/itstonight/ziyue/db"
	"github.com/itstonight/ziyue/router"
)

func main() {
	if err := config.Load("config.yaml"); err != nil {
		panic(err)
	}

	if err := db.Boot(config.C.Database.DSN); err != nil {
		panic(err)
	}

	engine := gin.Default()

	router.SetupRouter(engine)

	if err := engine.Run(":8080"); err != nil {
		panic(err)
	}
}
